USE [TAW]
GO

/****** Object:  Table [dbo].[StaffAttendance]    Script Date: 07/22/2012 17:23:55 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[StaffAttendance](
	[StaffNo] [nvarchar](50) NOT NULL,
	[AttendanceDate] [date] NOT NULL,
	[OnDutyTime] [datetime] NULL,
	[OffDutyTime] [datetime] NULL,
 CONSTRAINT [PK_StaffAttendance] PRIMARY KEY CLUSTERED 
(
	[StaffNo] ASC,
	[AttendanceDate] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO


CREATE TABLE [dbo].[TimeCardInfo](
	[Id] [int] IDENTITY(1,1) NOT NULL,
	[CardNo] [nvarchar](50) NOT NULL,
	[TakenDateTime] [datetime] NOT NULL,
	[DeviceNo] [nvarchar](50) NOT NULL,
	[Status] [bit] NOT NULL,
	[InsertDateTime] [datetime] NULL,
	[SourceInfo] [nvarchar](50) NULL,
 CONSTRAINT [PK_TimeCardInfo] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

/****** Object:  Index [IX_TimeCardInfo_CardNo]    Script Date: 07/22/2012 17:24:45 ******/
CREATE NONCLUSTERED INDEX [IX_TimeCardInfo_CardNo] ON [dbo].[TimeCardInfo] 
(
	[CardNo] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
GO


alter table Namelist
add CardNo nvarchar(50) null;